package com.ewanghuiju.app.ui.shopmail.adapter;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ewanghuiju.app.R;
import com.ewanghuiju.app.model.bean.local.LimitedSeckillTopBean;

/**
 * @author sj  qq:751943509
 * @class 限时秒杀 顶部
 * @time 2020/2/20
 */
public class LimitedSeckillTabAdapter extends BaseQuickAdapter<LimitedSeckillTopBean, BaseViewHolder> {
    public LimitedSeckillTabAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    protected void convert(BaseViewHolder helper, LimitedSeckillTopBean item) {
        helper.setText(R.id.tv_time, item.getTitle());
        TextView tv_status = helper.getView(R.id.tv_status);
        if(item.getStatus()==0){
            tv_status.setText("即将开始");
            tv_status.setTextColor(mContext.getResources().getColor(R.color.color_666));
            tv_status.setBackgroundColor(mContext.getResources().getColor(R.color.transparent));
        }else if(item.getStatus()==1){
            tv_status.setText("抢购中");
            tv_status.setTextColor(mContext.getResources().getColor(R.color.white));
            tv_status.setBackgroundResource(R.drawable.corner_primary_button_50);
        }
    }
}
